package com.shareit.ocr.domain.template;

import java.util.ArrayList;
import java.util.List;

/**
 * 基础费用详细信息模版
 * @author geai
 *
 */
public class InvoiceDataItemArrayTemplate {

	protected List<InvoiceDataItemTemplate> items = new ArrayList<InvoiceDataItemTemplate>();
	private final InvoiceDataItemTemplate template;
	
	public InvoiceDataItemArrayTemplate(InvoiceDataItemTemplate template) {

		this.template =template;
	}
	
	public InvoiceDataItemTemplate addItem() {
		
		InvoiceDataItemTemplate idftemplate =(InvoiceDataItemTemplate)template.copy();
		items.add(idftemplate);
		return idftemplate;
	}
	
	public void setItemsData(Object object) {
		List<?> objects = (List<?>)object;
		for(Object obj:objects) {
			InvoiceDataFieldsTemplate idftemplate = this.addItem();
			idftemplate.setDataFields(obj);
		}
	}
	
	public String getSplitChar() {
		return template.getSplitChar();
	}

	public List<InvoiceDataItemTemplate> getItems() {
		return items;
	}

	@Override
	public String toString() {
		return "InvoiceDataItemArrayTemplate [items=" + items + "]";
	}
	

	
}
